package StudyCode.summary.myfile;

import java.util.Arrays;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ConvertBooleanToByteArray {
	public static void main(String[] argv) throws Exception {
		boolean value = true;
		System.out.println(value + "转为字节数组:");
		System.out.println(Arrays.toString(booleanToByteArray(value)));
	}

	private static byte[] booleanToByteArray(boolean value) {
		return new byte[]{(byte) (value ? 0x01 : 0x00)};
	}
}
